package com.trkj.property_controller;

import com.trkj.entity.HouseExpenseEntity;
import com.trkj.entity.ZongEntity;
import com.trkj.service.HouseExpenseService;
import com.trkj.vo.AjaxResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.zip.ZipEntry;

@RestController
@Slf4j
@CrossOrigin
public class HouseExpenseController {
    @Autowired
    private HouseExpenseService houseExpenseService;

    @PostMapping("/selectAllExpense")
    public AjaxResponse selectAllExpense(@RequestBody HouseExpenseEntity houseEntity, @RequestParam("currentPage")int currentPage, @RequestParam("pageSize")int pageSize){
        log.info("{}",houseEntity);
        return AjaxResponse.success(houseExpenseService.selectAll(houseEntity,currentPage, pageSize));
    }
    @PostMapping("/findItem")
    public List<HouseExpenseEntity> findItem(){
       return houseExpenseService.findItem();
    }
    @PostMapping("/findAllEx")
    public AjaxResponse findAllEx(@RequestBody HouseExpenseEntity houseEntity,@RequestParam("currentPage")int currentPage, @RequestParam("pageSize")int pageSize){
        return AjaxResponse.success(houseExpenseService.findAllEx(houseEntity,currentPage, pageSize));
    }
    @PostMapping("findAll")
    public List<ZongEntity> findAll(){
        return houseExpenseService.findAll();
    }

}
